//
//  NetRequest.h
//  TestCpp
//
//  Created by Paladin on 13-3-11.
//
//

#ifndef __TestCpp__NetRequest__
#define __TestCpp__NetRequest__

#include "cocos2d.h"
#include "cocos-ext.h"
#include "json.h"
#include "PostData.h"

USING_NS_CC;
USING_NS_CC_EXT;
using namespace Json;

class CNetRequest {

public:
    CNetRequest(std::string aRequestTag = ""/*optional*/);
    
    // http request with GET method
    void requestWithGet(const char* url, CCObject* object, SEL_CallFuncND func);
    // http request with POST method
    void requestWithPost(const char* url, CPostData* postData, CCObject* object, SEL_CallFuncND func);
    
    inline int getTimeoutForConnect();
    
    inline void setTimeoutForConnect(int value);

private:
    void encryption(void *data);
    
    std::string mRequestTag;
};

#endif /* defined(__TestCpp__NetRequest__) */
